home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 2 / Meeting Pearls Vol. II (1995)(GTI - Schatztruhe)[!].iso / Pearls / gfx / pbm / special / PIPE.LHA / pipe.readme < prev   
Text File  |  1995-01-16  |  4KB  |  113 lines

  1. Short: AmigaShell PIPE command
  2. Type: util/shell
  3. Uploader: mlelstv@serpens.rhein.de
  4. Author: mlelstv@serpens.rhein.de
  5.  
  6. One of the nice features of a UNIX shell is the possibility
  7. to chain several commands together so that the output of
  8. one command is passed as the input of the next command.
  9.  
  10. With the AmigaShell you have to launch each task individually
  11. in the background with the RUN command and proper redirection
  12. to individual PIPEs (as AmigaDOS PIPEs need a unique name, there
  13. are no 'unnamed' pipes as in UNIX).
  14.  
  15. An undocumented feature of the AmigaShell since AmigaOS2.0 is
  16. the possibility to pass chains of commands on a single command
  17. line to an external command for evaluation. This is done by
  18. setting the local shell variables _pchar and _mchar to some
  19. strings. Whenever one of these strings appears on the command
  20. line the shell will pass the total commandline to the program
  21. C:PIPE (or a resident PIPE command) for further evaluation.
  22. The shell will not execute the commands in the pipe itself.
  23.  
  24. Andy Finkel (author of the AmigaShell) did publish such a C:PIPE
  25. program some time ago. Unfortunately this program has a couple
  26. of bugs.
  27.  
  28. Here is my version of C:PIPE with hopefully less bugs.
  29.  
  30. ----------------------------------------------------------------------------
  31. How to use install PIPE:
  32.  
  33. Copy PIPE to your C: directory, you should preserve the protection
  34. flags or set the p bit manually with the PROTECT command. This
  35. ensures that you can load the program into the shell's resident
  36. list.
  37.  
  38. In your shell-startup you insert the commands
  39.  
  40. set _pchar "|"
  41. set _mchar "||"
  42.  
  43. to activate the PIPE command. _pchar refers to the actual pipe chaining,
  44. _mchar is used to group commands that are executed sequentially (and whose
  45. output can be passed into another command). You can use other strings than
  46. "|" or "||" but you should be careful not to conflict with common strings
  47. used as parameters. You cannot use ";" as this starts a comment that is
  48. removed by the AmigaShell. Of course, you cannot use "<" or ">" either.
  49.  
  50. Now make sure that you have mounted the PIPE: device.
  51.  
  52. ----------------------------------------------------------------------------
  53. How to use PIPE:
  54.  
  55. When you have set up the shell-startup you can run a new shell. Something
  56. like
  57.  
  58. LIST | MORE
  59.  
  60. will now show a directory listing page by page. Users of the pbmplus
  61. package will like the possibility to
  62.  
  63. djpeg mypic.jpg | pnmscale -xysize 320 200 | ppmtoilbm -ham >mypic.iff
  64.  
  65. There are some commands that do not use the standard input and output
  66. but want explicit file names instead. One prominent example is the C:SORT
  67. command. It would be nice to use
  68.  
  69. LIST | SORT | MORE
  70.  
  71. to get a sorted directory listing, but since SORT does not read its
  72. input this is not possible. As a solution the PIPE command will replace
  73. the arguments IN: and OUT: with the actual AmigaDOS PIPE: names used. So
  74.  
  75. LIST | SORT FROM IN: TO OUT: | MORE
  76.  
  77. will do what we want. The argument replacement occurs only once for each
  78. command (the last parameter named IN: or OUT: is replaced) since you can
  79. only open or create a pipe once.
  80.  
  81. ----------------------------------------------------------------------------
  82. I/O-Redirection:
  83.  
  84. The AmigaShell just supports one input and one output redirection on the
  85. command line. The redirection is used for the complete pipeline, independent
  86. on where the redirection is placed on the command line. The input redirection
  87. affects the _first_ command on the line, the output redirection affects the
  88. last command on the line.
  89.  
  90. Aborts:
  91.  
  92. When you run a pipe then a CTRL-C/D/E/F will be send to the _last_ command
  93. in the pipe. When this command stops it closes its input pipe and the
  94. program that writes to that pipe should see a write error and stop.
  95. Unfortunately there are some programs that ignore write errors and will
  96. continue to run. Their output is discarded by the PIPE: device, but they
  97. may take some time to complete. If necessary you can use the C:BREAK command
  98. to send them individual break signals.
  99.  
  100. Queue-Handler:
  101.  
  102. The AmigaDOS PIPE: device (at least the one in 3.0 and 3.1) has a bug that
  103. will make it loose data whenever a program writes to a pipe with a Write()
  104. call larger than the buffer size of the pipe. There is a replacment queue-
  105. handler from Heinz Wrobel in beta test that fixes this problem.
  106.  
  107. IN: and OUT:
  108.  
  109. The command line parser does not look at quoted strings for replacement.
  110. I.e. you should use IN: and OUT: and not "IN:" and "OUT:".
  111.  
  112. Michael van Elst
  113.